from rest_framework import  serializers
from .models import *


class AssetsTypeSerializer(serializers.ModelSerializer):
    class Meta:
        model = AssetsType
        fields = ('id', 'name')


class LocationSerializer(serializers.ModelSerializer):
    class Meta:
        model = Location
        fields = "__all__"


class AssetsSerializer(serializers.ModelSerializer):
    place = serializers.ReadOnlyField(source='place.name')
    asstesType = serializers.ReadOnlyField(source='asstesType.name')
    assetsStatus = serializers.ReadOnlyField(source='get_assetsStatus_display')

    class Meta:
        model = Assets
        fields = "__all__"

class AssetsModifySerializer(serializers.ModelSerializer):
    class Meta:
        model = Assets
        fields = "__all__"

